//
//  PlayCell.m
//  Everest
//
//  Created by 李其昌 on 14/12/17.
//  Copyright (c) 2014年 ThreeL. All rights reserved.
//

#import "PlayCell.h"

#define kCellWidth [UIApplication sharedApplication].keyWindow.bounds.size.width


@implementation PlayCell

- (void)dealloc
{
    [_abstract release];
    [_myImageView release];
    [_userName release];
    [_numberLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.myImageView = [[UIImageView alloc] init];
        [self addSubview:self.myImageView];
        [_myImageView release];
        self.numberLabel = [[UILabel alloc] init];
        self.numberLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.numberLabel];
        [_numberLabel release];
        self.userName = [[UILabel alloc] init];
        self.userName.textColor = [UIColor colorWithRed:68 / 255.0 green:150 / 255.0 blue:232 / 255.0 alpha:1];
        [self addSubview:self.userName];
        [_userName release];
        self.abstract = [[UILabel alloc] init];
        self.abstract.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.abstract];
        [_abstract release];
    }
    return self;
}

- (void)layoutSubviews
{
    self.myImageView.frame = CGRectMake(5 , 10, self.bounds.size.height - 20, self.bounds.size.height - 20);
    self.myImageView.layer.cornerRadius = self.myImageView.bounds.size.height / 2;
    self.myImageView.clipsToBounds = YES;
    self.userName.frame = CGRectMake(kCellWidth / 4 + 5, 5, kCellWidth / 3, (self.bounds.size.height - 20) / 3);
    self.numberLabel.frame = CGRectMake(kCellWidth / 4 + 5, 10 + (self.bounds.size.height - 20) / 3, kCellWidth / 2, (self.bounds.size.height - 20) / 3);
    self.abstract.frame = CGRectMake(kCellWidth / 4 + 5, 15 + (self.bounds.size.height - 20) / 3 * 2, kCellWidth / 2, (self.bounds.size.height - 20) / 3);
}

- (void)awakeFromNib {
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
